Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@sinonjs/formatio
Advanced tools
The @sinonjs/formatio package is a utility for pretty-printing JavaScript values, particularly useful for producing human-readable output of complex objects and structures. It is often used in testing frameworks to format output for assertions and logs.
Pretty-printing objects
This feature allows the pretty-printing of objects into a string format that is easy to read, especially useful for debugging or displaying complex data structures in logs.
const formatio = require('@sinonjs/formatio');
const obj = { name: 'Alice', age: 25, details: { hobbies: ['reading', 'cycling'] } };
console.log(formatio.ascii(obj));
Custom depth for formatting
This feature enables control over how deep the formatting should go when converting objects to strings. It helps in avoiding too much verbosity by limiting the depth of object traversal.
const formatio = require('@sinonjs/formatio');
const obj = { name: 'Alice', age: 25, details: { hobbies: ['reading', 'cycling'], location: 'City' } };
console.log(formatio.ascii(obj, { maxDepth: 1 }));
pretty-format is a package developed by Facebook as part of the Jest testing framework. It offers similar functionality to @sinonjs/formatio by providing a way to serialize JavaScript objects into strings for snapshot testing. It supports plugins to handle different types of objects and is more extensible compared to @sinonjs/formatio.
util-inspect is a node module that provides an inspection function similar to Node.js core's util.inspect method. It is used for converting objects into strings for debugging purposes. While it shares similar basic functionality with @sinonjs/formatio, it is more tightly integrated with Node.js's core modules and might offer better performance in a Node.js environment.
The cheesy object formatter
Pretty formatting of arbitrary JavaScript values. Currently only supports ascii
formatting, suitable for command-line utilities. Like JSON.stringify
, it
formats objects recursively, but unlike JSON.stringify
, it can handle
regular expressions, functions, circular objects and more.
formatio
is a general-purpose library. It works in browsers (including old
and rowdy ones, like IE6) and Node. It will define itself as an AMD module if
you want it to (i.e. if there's a define
function available).
npm install @sinonjs/formatio
https://sinonjs.github.io/formatio/
Support us with a monthly donation and help us continue our activities. [Become a backer]
Become a sponsor and get your logo on our README on GitHub with a link to your site. [Become a sponsor]
formatio was released under BSD-3
FAQs
Human-readable object formatting
The npm package @sinonjs/formatio receives a total of 0 weekly downloads. As such, @sinonjs/formatio popularity was classified as not popular.
We found that @sinonjs/formatio demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.